package dao;

import java.util.HashMap;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import vo.DonationVO;
import vo.MemberVO;
import vo.OrganizationVO;

@Repository
public class DonationDaoImpl implements DonationDao {
	@Resource(name = "sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public List<OrganizationVO> getOrganization(MemberVO mvo) {
		System.out.println("dao organization");
		
		return sqlSessionTemplate.selectList("donation.getOrganization");
	}

	@Override
	public MemberVO getMember(MemberVO mvo) {
		System.out.println("dao redbeanMember");
		
		return sqlSessionTemplate.selectOne("donation.getMember", mvo);
	}

	@Override
	public OrganizationVO getDonationDetail(int ono) {
		System.out.println("dao donationdetail");
		
		return sqlSessionTemplate.selectOne("donation.getdonationdetail", ono);
	}

	@Override
	public List<DonationVO> getDonationList(MemberVO mvo) {
		System.out.println("dao donationlist");
		
		List<DonationVO> donation = sqlSessionTemplate.selectList("donation.getDonationList");
		
		System.out.println(donation.size());
		return sqlSessionTemplate.selectList("donation.getDonationList");
	}

	@Override
	public int updateDonation(MemberVO vo) {
		return sqlSessionTemplate.update("donation.updateDonation", vo);
	}

	@Override
	public int updateOrganization(MemberVO vo) {
		return sqlSessionTemplate.update("donation.updateOrganization", vo);
	}

	@Override
	public MemberVO selectMReadbean(String mid) {
		return sqlSessionTemplate.selectOne("donation.selectMReadbean", mid);
	}

}
